<template>
    <div class="logFund">

    <el-dialog
        :visible.sync="dialog.bool"
        :close-on-click-modal="false"
        :close-on-press-escape="false"
        :modal-append-to-body="false"
    >
     <el-table
    :data="dialogData"
    border
   @selection-change="getDetails"
    style="width: 100%"
    >
   <el-table-column
       :disabled="value"
      type="selection"
      width="55">
    </el-table-column>
    <el-table-column
      prop="member_id"
      label="用户ID"
      >
    </el-table-column>
    <el-table-column
      prop="member_name"
      label="用户名称"

      >
    </el-table-column>
    <el-table-column
      prop="member_mobile"
      label="手机号码"
      >
    </el-table-column>
    <el-table-column
      prop="ruwei_count"
      label="入围次数"
      v-if="types == 0"
      >
    </el-table-column>
      </el-table>
      <div class="pagination">
          <el-pagination background
      		@current-change="handleCurrentChange2"
      		layout="prev, pager, next"
      		:current-page="rightPage"
            :total="rightPages"
      		:page-size="10">
          </el-pagination>
      </div>
      <div style="text-align:center">
       <el-time-select
        v-model="value"
        :picker-options="{
          start: '12:00',
          step: '2:00',
          end: '22:00'
        }"
        placeholder="选择时间">
</el-time-select>

      <el-button @click="zhongjiang()" type="primary"  size="small">暗箱操作</el-button>

      </div>

    </el-dialog>
    </div>
</template>
<script>
    export default {
         props:["dialog","dialogData","types","detail","rightPage","rightPages","rightPageSize","rowri","rowrd"],
        name:"dialofound",
        data(){
            return {
                vis:false,
                value:'',
                obj:{},
                arr:[],
                st:'',
                cu:false,
                rs:[]
            }
        },
        methods:{
            handleCurrentChange2(val){
                if(this.types){
                 this.$parent.handleZj(this.rowri,val)
                }else{
                 this.$parent.handleRw(this.rowrd,val)
                }
            },
            zhongjiang(){
                for (var index in this.rs) {
                    this.arr.push(this.rs[index].member_id)
                }
                let c =  [...new Set(this.arr)]
                let str = c.toString()

                if(this.value == ''||this.value == null){
                     this.$message('请输入中奖时间')
                    return false
                }else{
                    this.$set(this.obj,this.value,str)
                    let winning = JSON.stringify(this.obj)
                    if(this.types){
                        let pram = {
                               winning:winning,
                               group_detail_id:this.detail
                        }
                        this.$post_('group/group/set-member',pram,(res) => {
                            if(res.code==0){
                              this.$message({
                                  message:"添加成功",
                                   type: 'success'
                              })
                            }
                        })
                    }else{
                        let pram = {
                               fina:winning,
                               group_detail_id:this.detail
                        }
                        console.log(pram)
                        this.$post_('group/group/set-member',pram,(res) => {
                            if(res.code==0){
                              this.$message({
                                  message:"添加成功",
                                   type: 'success'
                              })
                            }
                        })
                    }
                     this.obj ={}
                     this.arr = []
                     this.rs = {}
                     this.$emit('changeDetail', this.vis )


                }
            },
            getDetails(row){

                 this.rs = row
                 console.log(this.rs)
            },
            judgeTime(){
                if(new Date().getHours()>12){
                       this.cu = true
                    }
            }
        },
        created(){
            this.judgeTime()
        }
    }
</script>
